import 'package:aoe_flutter/widgets/dialogs/MessageDialog.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:toast/toast.dart';

/// @author wujianchuan,ghj
/// @date 2019/12/28 16:16
@deprecated
enum TipType {
  INFO,
  WARNING,
  ERROR,
  ACCENT,
}

class TipsTool {
  TipsTool();

  static TipsTool info(
    String message, {
    Widget icon,
    String title,
    Duration duration,
  }) {
    MessageDialog(
      title: title ?? '提示',
      message: message,
    );
    return TipsTool();
  }

  static accent(
    String message, {
    Widget icon,
    String title,
    Duration duration,
  }) {
    MessageDialog(
      title: title ?? '成功',
      message: message,
    );
    return TipsTool();
  }

  static TipsTool error(
    String message, {
    Widget icon,
    String title,
    Duration duration,
  }) {
    MessageDialog(
      title: title ?? '错误',
      message: message,
    );
    return TipsTool();
  }

  /// 统一使用error
  @deprecated
  static TipsTool warning(
    String message, {
    Widget icon,
    String title,
    Duration duration,
  }) {
    MessageDialog(
      title: title ?? '警告',
      message: message,
    );
    return TipsTool();
  }

  /// 不再需要调用show()方法，比如：直接这样TipsTool.accent('保存成功');
  @deprecated
  void show() {}
  
  @deprecated
  void _showToast(String msg, BuildContext context,
      {int duration, int gravity}) {
    Toast.show(msg, context, duration: duration, gravity: gravity);
  }
}
